{extend name="public/base" /}
{block name="content"}
<div class="page-content">
    <!-- Page Breadcrumb -->
    <div class="page-breadcrumbs">
        <ul class="breadcrumb">
            <li class="active">
                <i class="fa fa-home"></i>&nbsp;管理员管理
            </li>
            <li>
                管理员添加
            </li>
        </ul>
    </div>
    <!-- /Page Breadcrumb -->
    <!-- Page Body -->
    <div class="page-body">
        <div class="row">
            <div class="col-xs-12">
                <div class="widget radius-bordered">
                    <div class="widget-header bordered-bottom bordered-themeprimary">
                        <span class="widget-caption">管理员添加</span>
                    </div>
                    <div class="widget-body">
                        <form class="form-horizontal">
                            <div class="form-group">
                                <label for="username" class="col-sm-2 control-label no-padding-right">账号</label>
                                <div class="col-sm-6">
                                    <input type="text" class="form-control" id="username" name="username" placeholder="输入账号" />
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="password" class="col-sm-2 control-label no-padding-right">密码</label>
                                <div class="col-sm-6">
                                    <input type="password" class="form-control" id="password" name="password" placeholder="输入密码">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="conpass" class="col-sm-2 control-label no-padding-right">确认密码</label>
                                <div class="col-sm-6">
                                    <input type="password" class="form-control" id="conpass" name="conpass" placeholder="确认密码">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="status" class="col-sm-2 control-label no-padding-right">状态</label>
                                <div class="col-sm-6">
                                    <select name="status" id="status" class="form-control">
                                        <option value="0">禁用</option>
                                        <option value="1">启用</option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="email" class="col-sm-2 control-label no-padding-right">邮箱</label>
                                <div class="col-sm-6">
                                    <input type="email" class="form-control" id="email" name="email" placeholder="邮箱">
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-offset-2 col-sm-10">
                                    <button type="submit" id="adminAdd" class="btn btn-primary">添加</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- /Page Body -->
</div>
{/block}
{block name="js" /}
{__block__}
<script>
    $('#adminAdd').click(function () {
        $.ajax({
            url:"{:url('admin/home/adminadd')}",
            type:'post',
            data:$('form').serialize(),
            dataType:'json',
            success:function (data) {
                if (data.code == 1) {
                    layer.msg(data.msg, {
                        icon:6,
                        time:2000
                    }, function () {
                        location.href = data.url;
                    });
                }else {
                    layer.open({
                        title:'管理员账户添加失败！',
                        content:data.msg,
                        icon:5,
                        anim:6
                    });
                }
            }
        });
        return false;
    });
</script>
{/block}